<?php
/*
 * Created on Mar 10, 2010
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
?>
<?php
require_once APPPATH."controllers/cms_template.php";
class cms_gallery_template extends cms_template{

  	function __construct(){
   		parent::__construct();
   		$this->_template_type = 'gallery';
		$this->load->model('Model_mediaset', 'model_mediaset');
  	}

	function add($level = 1, $nav_id = 0){
		 if ($this->input->post('Submit')) {
			// Serialize t1
			$t1 = parse_input("t1_", $_POST);
			$_POST['item_t1'] = serialize($t1);
		 }
		 else{
		 	$this->_assign['mediaset'] = $this->model_mediaset->fetch_all();
			//var_dump($this->_assign['mediaset']);
		 }
		 return parent::add($level, $nav_id);
    }

    function edit($level = 1, $nav_id = 0, $id = 0){
    	if ($this->input->post('Submit')) {
			// Serialize t1
			$t1 = parse_input("t1_", $_POST);
			$t2 = parse_input("t2_", $_POST);
			$t3 = parse_input("t3_", $_POST);
			$_POST['item_t1'] = serialize($t1);
			$_POST['item_t2'] = serialize($t2);
			$_POST['item_t3'] = serialize($t3);
		 }
		 else{
		 	$this->_assign['datagroups'] = $this->model_datagroup->fetch_all();
		 }
		 parent::edit($level, $nav_id, $id);
    }
}
?>